
<!DOCTYPE html>
<html>
<head>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>

<link rel="stylesheet" type="text/css" href="theme/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="theme/default/css/common.css">
<script src="theme/default/Js/Common.js"></script>
<script src="theme/default/Js/jquery.min.js"></script>
<script src="theme/default/js/artDialog.js?skin=blue"></script>
<link rel="stylesheet" type="text/css" href="include/webupload/webuploader.css">
<script src="include/webupload/webuploader.min.js"></script> 
<script src="include/webupload/uploads.js"></script>
<link rel='stylesheet' type="text/css" href='theme/desktop/css/font-awesome.min.css'>

</head>
<body>

<script>
	<!-- 必填项提示
	function CheckInput()
	{
		if (1=="1"){if(document.all.oLinkman.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '联系人不能为空!'});document.all.oLinkman.focus();return false;}}
		if (1=="1"){if(document.all.oSDate.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '下单日期不能为空!'});document.all.oSDate.focus();return false;}}
		if (0=="1"){if(document.all.oEDate.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '交单日期不能为空!'});document.all.oEDate.focus();return false;}}
		if (1=="1"){if(document.all.oDeposit.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '已收款不能为空!'});document.all.oDeposit.focus();return false;}}
		if (0=="1"){if(document.all.oContent.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '详情备注不能为空!'});document.all.oContent.focus();return false;}}
		if (0=="1"&&0!="1"){if(document.all.oshr.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '收货人不能为空'});document.all.oshr.focus();return false;}}
		if (0=="1"&&0!="1"){if(document.all.oshrdh.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '收货人电话不能为空'});document.all.oshrdh.focus();return false;}}
		if (0=="1"&&0!="1"){if(document.all.oshrdz.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '收货人地址不能为空'});document.all.oshrdz.focus();return false;}}
		
		

if(document.all.spmc.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '商品名称'+"不能为空!"});document.all.spmc.focus();return false;}

if(document.all.GengHuaSuanDe.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '更划算的'+"不能为空!"});document.all.GengHuaSuanDe.focus();return false;}

		
	}
	-->
	</script>

<!----------------------------------------订单处理开始----------------------------------------> 
<!----------------------------------------订单处理开始---------------------------------------->
<div class="cssout">
  <form class="layui-form" name="save" action="?action=order&stype=saveAudit&Id=5&LaiLu=" method="post" onSubmit="return CheckInput();">
    <div class="cssin">
      <ul>
        <li class="w100 bg">
          <dd class="isin"><B>订单处理</B></dd>
        </li>
        <li class="w20 bg tr">
          <dd class="isin"> 订单状态 </dd>
        </li>
        <li class="w80">
          <dd class="isin">
            <input class="btns" name="oState" type="radio" value="2"  title="已完成">
            <input class="btns" name="oState" type="radio" value="1"  title="处理中">
            <input class="btns" name="oState" type="radio" value="0"  checked title="转未处理">
          </dd>
        </li>
        <li class="w20 bg tr">
          <dd class="isin"> 发货状态 </dd>
        </li>
        <li class="w80">
          <dd class="isin">
            <input class="btns" name="fahuozt" type="radio" value="2"  title="已发货" onClick="Setdisabled(2)">
            <input class="btns" name="fahuozt" type="radio" value="1"  title="未发货" onClick="Setdisabled(1)">
            <input class="btns" name="fahuozt" type="radio" value="0"  checked title="无需发货" onClick="Setdisabled(0)">
          </dd>
        </li>
        
<div class="czbz1"  style="display:none;">
        <li class="w20 bg tr">
          <dd class="isin"> 发货时间 </dd>
        </li>
        <li class="w80">
          <dd class="isin">
            <input name="fahuosj" type="text" id="fahuosj" class="int Wdate" size="20" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:MM'})" value="">
          </dd>
        </li>
        <li class="w20 bg tr">
          <dd class="isin"> 物流公司 </dd>
        </li>
        <li class="w80">
          <dd class="isin">
            <input type="text" name="fahuowl" id="fahuowl" class="bor int" size="30" value="">
          </dd>
        </li>
        <li class="w20 bg tr">
          <dd class="isin"> 物流单号 </dd>
        </li>
        <li class="w80">
          <dd class="isin">
            <input type="text" name="fahuodh" id="fahuodh" class="bor int" size="30" value="">
          </dd>
        </li>
</div>
        
        <li class="w20 bg duohang tr">
          <dd class="isin"> 处理备注 </dd>
        </li>
        <li class="w80 duohang">
          <dd class="isin">
            <textarea name="oAuditReasons" rows="4" id="oAuditReasons" class="bor int" style="height:65px;width:98%;">
</textarea>
          </dd>
        </li>
        <div class="clear"></div>
      </ul>
    </div>
    <div class="h50b"></div>
    <div class="fixed_bg_B">
      <input type="submit" name="Submit" class="btn2 btnbaoc" value="保存">
      <input name="Back" type="button" id="Back" class="btn2 btnguanb" value="关闭" onClick="art.dialog.close();guanbi();">
    </div>
  </form>
  
  
<script>
function Setdisabled(evt)
{
   if(evt=="2"){
	  $(".czbz1").css("display","block")
	  
   }else{	   
	  $(".czbz1").css("display","none")
   }
}
</script>
  
  
</div>

<script>
 var show_count = 20;  //要显示的条数
     
      var count = 1;  //递增的开始值，这里是你的ID
      jQuery(document).on("click","#btn_addtr",function () {
		  
	  jQuery("#choosecpxx").val("")  //先清空获取框的值
        var length = $("#TabUse tbody tr").length;
        if (length < show_count)  //点击时候，如果当前的数字小于递增结束的条件
        {
          $("#TabMuban tbody tr").clone().appendTo("#TabUse tbody");  //在表格后面添加一行
          changeIndex();//更新行号
        }
      });
  
  
	function btnAddtrClick(){
		$("#choosecpxx").val("")  //先清空获取框的值
        var length = $("#TabUse tbody tr").length;
        if (length < show_count)  //点击时候，如果当前的数字小于递增结束的条件
        {
          $("#TabMuban tbody tr").clone().appendTo("#TabUse tbody");  //在表格后面添加一行
          changeIndex();//更新行号
        }
	}
    function changeIndex() {
	
		
      var i = $(".table_1").find("tr").length;
      $("#TabUse tbody tr").each(function () { //循环tab tbody下的tr
        $(this).find(".noxh").html("<span style='color:#f00;'>"+(i++)+"</span>");//更新行号
		$(this).attr("id", "tr"+i);
		$(this).attr("data-id", i);
      });
    }
  
    function deltr(opp) {
      var length = $("#TabUse tbody tr").length;
      /*if (length <= 1) {
        alert("至少保留一行");
      } else {*/
        $(opp).parent().parent().remove();//移除当前行
        changeIndex();
		qiuzonghe();//计算总数
      /*}*/
    }
function ChosecpOK(){
var max_id = 0;
$("#TabUse tbody tr").each(function () { //循环tab tbody下的tr的data-id值
  var data_id = parseInt($(this).attr("data-id"));
  if (data_id > max_id) {
   max_id = data_id;
  }
})
  
var trid="#tr"+max_id
var choosecpxx=$("#choosecpxx").val()
arr=choosecpxx.split('|');//注split可以用字符或字符串分割
for(var i=0;i<arr.length;i++)
{
$(trid+" input[name='xproid']").val(arr[0])
$(trid+" .xoname").text(arr[1])
$(trid+" .xoguige").text(arr[2])
$(trid+" .xoxinghao").text(arr[3])
$(trid+" .xochengben").text(arr[4])	
$(trid+" input[name='xopprice']").val(arr[5])
$(trid+" input[name='xopnum']").val(arr[6])
$(trid+" input[name='xodiscount']").val(arr[7])
$(trid+" input[name='xomoney']").val(arr[5])
$(trid+" input[name='xocontent']").val(arr[9])
//alert(arr[i]);
}
qiuzonghe();
}
//委托绑定事件
$(document).on('change',"input[name='xopprice'],input[name='xopnum'],input[name='xodiscount'],",function(event) {
	var that = $(this),//得到当前对象
	parentTr = that.parent().parent();//得到tr父级
	var xopprice = parentTr.find("input[name='xopprice']").val(),//获取单价
		xopnum = parentTr.find("input[name='xopnum']").val(),//获取数量
		xodiscount = parentTr.find("input[name='xodiscount']").val();//获取折扣
		//xodiscount = xodiscount<=0?1:xodiscount;//折扣不能小于等0，否则为1
	var priceCount = xopprice*xopnum-xodiscount;//计算总金额
	parentTr.find("input[name='xomoney']").val(priceCount);//结果赋值给总金额
//}).on("click","#btnCountPrice",function(){
}).on('change',"input[name='xopprice'],input[name='xopnum'],input[name='xodiscount'],",function(){
	qiuzonghe()
});
qiuzonghe()
function qiuzonghe(){
	var xopprices=0,//单价
	xopnums=0,//数量
	xodiscount=0,//折扣
	priceCount=0;//总价
	//获取单价集合
	$("#TabUse input[name='xopprice'],.xopprice").each(function(index, el) {
		xopprices += $(el).val()==''?0:parseInt($(el).val());
	});
	//获取数量集合
	$("#TabUse input[name='xopnum'],.xopnum").each(function(index, el) {
		xopnums += $(el).val()==''?0:parseInt($(el).val());
	});
	//获取折扣集合
	$("#TabUse input[name='xodiscount'],.xodiscount").each(function(index, el) {
		xodiscount +=  $(el).val()==''?0:parseInt($(el).val());
	});
	//获取折扣集合
	$("#TabUse input[name='xomoney'],.xomoney").each(function(index, el) {
		priceCount +=  $(el).val()==''?0:parseInt($(el).val());
	});
	//priceCount = xopprices*xopnums-xodiscount;//总价
	if(isNaN(priceCount)){ priceCount = 0}
	
	$("#zh01").text(xopprices+"元")
	$("#zh02").text(xopnums)
	$("#zh03").text(xodiscount+"元")
	$("#zh04").text(priceCount+"元")
	
	$("#omoney").val(priceCount)
	
	
}
</script> 
<script src="theme/default/WdatePicker.js"></script> 
<script src="theme/layui/layui.js"></script> 
<script src="theme/desktop/js/common.js"></script>

<script>
/*弹出窗口封装代码*/
$(".open-app").on("click",function(){
	var width = $(this).data("width")?$(this).data("width"):900,//获得宽度
	height = $(this).data("height")?$(this).data("height"):400//获得高度
	url = $(this).attr("href")//获得打开URL
	title = $(this).attr("title");//获得标题	
	$.dialog.open(url, {title: title, width:width,height:height, fixed: true});
	return false;	
})
</script>

</body>
</html>
